# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import Union
from fastapi import Query
from pydantic import BaseModel, Field


class DrawsPromptCategorySearchIn(BaseModel):
    """ 绘画提示词分类搜索参数 """
    engine: str = Query(..., pattern=r"^(mj|sd|dalle|doubao)$", description="绘图引擎")
    name: Union[str, None] = Query(default=None, description="分类名称")
    is_disable: Union[int, str, None] = Query(default=None, description="是否禁用: [0=否, 1=是]")
    start_time: Union[int, str, None] = Query(default=None, description="开始时间")
    end_time: Union[int, str, None] = Query(default=None, description="结束时间")


class DrawsPromptCategoryAddIn(BaseModel):
    """ 绘画提示词分类新增参数 """
    engine: str = Field(..., pattern=r"^(mj|sd|dalle|doubao)$", description="绘图引擎")
    name: str = Field(..., min_length=1, max_length=100, description="分类名称")
    sort: int = Field(default=0, ge=0, le=999999, description="排序编号")
    is_disable: int = Field(default=0, ge=0, le=1, description="是否禁用: [0=否, 1=是]")

    class Config:
        json_schema_extra = {
            "example": {
                "engine": "mj",
                "name": "动漫",
                "sort": 0,
                "is_disable": 0
            }
        }


class DrawsPromptCategoryEditIn(BaseModel):
    """ 绘画提示词分类编辑参数 """
    id: int = Field(..., gt=0, description="ID")
    engine: str = Field(..., pattern=r"^(mj|sd|dalle|doubao)$", description="绘图引擎")
    name: str = Field(..., min_length=1, max_length=100, description="分类名称")
    sort: int = Field(default=0, ge=0, le=999999, description="排序编号")
    is_disable: int = Field(default=0, ge=0, le=1, description="是否禁用: [0=否, 1=是]")

    class Config:
        json_schema_extra = {
            "example": {
                "id": 1,
                "engine": "mj",
                "name": "动漫",
                "sort": 0,
                "is_disable": 0
            }
        }


class DrawsPromptCategoryDeleteIn(BaseModel):
    """ 绘画提示词分类删除参数 """
    id: int = Field(..., gt=0, description="ID")
    engine: str = Field(..., pattern=r"^(mj|sd|dalle|doubao)$", description="绘图引擎")

    class Config:
        json_schema_extra = {
            "example": {
                "id": 1,
                "engine": "mj"
            }
        }


"""--------------- Separator ---------------"""


class DrawsPromptCategoryVo(BaseModel):
    """ 绘画提示词分类Vo """
    id: int = Field(description="ID")
    engine: str = Field(description="绘图引擎: [mj,sd,dalle,doubao]")
    name: str = Field(description="分类名称")
    sort: int = Field(description="排序编号")
    is_disable: int = Field(description="是否禁用: [0=否, 1=是]")
    create_time: str = Field(description="创建时间")

    class Config:
        json_schema_extra = {
            "example": {
                "id": 1,
                "engine": "mj",
                "name": "动漫",
                "sort": 0,
                "is_disable": 0,
                "create_time": "2024-04-18 11:22:33"
            }
        }
